﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Electronic_work_order.Model;
using Electronic_work_order.Interfacess.OA_Agency;
namespace Electronic_work_order.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class OA_AgencysController : ControllerBase
    {
        private readonly Interfacess_Agency _agency;

        public OA_AgencysController(Interfacess_Agency agency)
        {
            _agency = agency;
        }


        [HttpGet]
        [Route("/[controller]/GetCcommission")]
        //根据流水号，申请流程名称，申请状态查询
        public IEnumerable<object> GetCcommission(string Agency_ID, int Aid, int StateID)
        {
            return _agency.GetCcommission(Agency_ID, Aid, StateID);
        }

        [HttpGet]
        [Route("/[controller]/GetCcommission_AllID")]
        //申请流程名称，申请状态查询
        public IEnumerable<object> GetCcommission_AllID( int Aid, int StateID)
        {
            return _agency.GetCcommission_AllID(Aid, StateID);
        }


        [HttpGet]
        [Route("/[controller]/GetCcommission_StateID")]
        //申请状态查询
        public IEnumerable<object> GetCcommission_StateID(int StateID)
        {
            return _agency.GetCcommission_StateID( StateID);
        }

        [HttpGet]
        [Route("/[controller]/GetCcommission_Aid")]
        //申请流程名称
        public IEnumerable<object> GetCcommission_Aid(int Aid)
        {
            return _agency.GetCcommission_Aid(Aid);
        }


        [HttpGet]
        [Route("/[controller]/GetCcommission_Agency_ID")]
        //申请流程名称
        public IEnumerable<object> GetCcommission_Agency_ID(string Agency_ID)
        {
            return _agency.GetCcommission_Agency_ID(Agency_ID);
        }


        [HttpGet]
        [Route("/[controller]/Agencys")]
        public IEnumerable<object> Agencys()
        {
            return _agency.Agencys();
        }

        [HttpGet]
        [Route("/[controller]/Agency")]
        public IEnumerable<object> Agency(int state,int PositoionID)
        {
            return _agency.Agency(state, PositoionID);
        }

        [HttpGet]
        [Route("/[controller]/Agency_manager")]
        public IEnumerable<object> Agency_manager(int State, int PositoionID)
        {
            return _agency.Agency_manager(State, PositoionID);
        }
            [HttpGet]
        [Route("/[controller]/Agency_JieBan")]
      public  IEnumerable<object> Agency_JieBan()
        {
            return _agency.Agency_JieBan();
        }
        [HttpPost]
        [Route("/[controller]/AddCommission")]
        public int AddCommission(commission commission)
        {
            return _agency.AddCommission(commission);
        }
        [HttpDelete]
        [Route("/[controller]/Delete")]
        //若添加申请单成功的同时添加代办表时失败要根据流水号删除申请表
        public int Delete(int Agency_ID)
        {
            return _agency.Delete(Agency_ID);
        }

        [HttpPut]
        [Route("/[controller]/Update_staId")]
        public int Update_staId(string Agency_ID, int Process_State_ID, string AYiJian) {
            return _agency.Update(Agency_ID, Process_State_ID,AYiJian);
        }
        [HttpGet]
        [Route("/[controller]/GetPosition_UserName")]
        //根据职位查名称
        public object GetPosition_UserName(int PositionID)
        {
            return _agency.GetPosition_UserName(PositionID);
        }
        [HttpGet]
        [Route("/[controller]/getComXQ")]
        //  //流程详情查询
        public IEnumerable<object> getComXQ(int Aid, string AgencyID)
        {
            return _agency.getComXQ(Aid, AgencyID);
        }
        }
    }
